package routers

import (
	"pfl/controllers/admin"

	"github.com/astaxie/beego"
)

func Admin() {
	beego.Router("/login", &admin.LoginController{})
	beego.Router("/login/check", &admin.LoginController{}, "post:Check")
	beego.Router("/admin", &admin.ArticleController{}, "get:Add")
	beego.Router("/admin/user", &admin.UserController{})
	beego.Router("/admin/user/add", &admin.UserController{}, "get:Add")
	beego.Router("/admin/user/edit/:id", &admin.UserController{}, "get:Edit")
	beego.Router("/admin/user/editself/:id", &admin.UserController{}, "get:EditSelf")
	beego.Router("/admin/user/pwd/:id", &admin.UserController{}, "get:EditSelfPwd")
	//添加一个用户
	//param [num string](账号)
	//param [pwd string](密码)
	//param [name string](名称)
	//param [phone string](手机号码)
	//param [email string](邮箱)
	beego.Router("/admin/user/addnew", &admin.UserController{}, "post:CheckNew")

	//检查用户是否存在
	//param [num string](账号)
	beego.Router("/admin/user/repeat", &admin.UserController{}, "POST:CheckNum")

	//删除一个用户
	//param [id int](用户Id)
	beego.Router("/admin/user/deleteone", &admin.UserController{}, "GET,POST:DeleteOne")

	//分页获取用户列表
	//param [s int](开始的地方)
	//param [c int](取多少个)
	beego.Router("/admin/user/list", &admin.UserController{}, "GET,POST:GetList")

	//超级管理员更新一个用户的资料,不是更新自己的资料
	//param [id int](用户id)
	//param [name string](名称)
	//param [phone string](手机号码)
	//param [email string](邮箱)
	beego.Router("/admin/user/uone", &admin.UserController{}, "GET,POST:UpdateOne")

	//更新自己的资料
	//param [id int](用户id)
	//param [name string](名称)
	//param [phone string](手机号码)
	//param [email string](邮箱)
	beego.Router("/admin/user/uself", &admin.UserController{}, "GET,POST:UpdateSelf")

	//超级管理员禁用一个账户
	//param [id int]
	//param [fbd int](1为禁用，0为解禁)
	beego.Router("/admin/user/fbd", &admin.UserController{}, "GET,POST:ForbiddenOne")

	//超级管理员重置一个用户的密码
	//param [id int](用户id)
	//param [pwd string](重置的密码)
	beego.Router("/admin/user/cpo", &admin.UserController{}, "POST:ChangePwdOne")

	//重置自己的密码
	//param [id int](用户id)
	//param [oldpwd string](重置的密码)
	//param [newpwd string](重置的密码)
	beego.Router("/admin/user/cps", &admin.UserController{}, "GET,POST:ChangePwdSelf")

	//退出登录
	//param [id int](用户id)
	beego.Router("/admin/user/exit", &admin.UserController{}, "GET,POST:Exit")

	//////////////////////article///////////////////////////////
	beego.Router("/admin/article", &admin.ArticleController{})
	beego.Router("/admin/article/add", &admin.ArticleController{}, "get:Add")
	beego.Router("/admin/article/addnew", &admin.ArticleController{}, "Post:AddNew")
	beego.Router("/admin/article/ct", &admin.ArticleController{}, "Post:CheckTitle")
	beego.Router("/admin/article/edit/:id", &admin.ArticleController{}, "get:Edit")

	beego.Router("/admin/article/list", &admin.ArticleController{}, "Post:GetList")

	//删除一条新闻
	//param [id int](新闻Id)
	beego.Router("/admin/article/deletearticle", &admin.ArticleController{}, "GET,POST:DeleteArticle")

	beego.Router("/admin/article/editnew", &admin.ArticleController{}, "POST:EditNew")

	//修改轮播图
	//beego.Router("/admin/article/lunbotu/:id", &admin.ArticleController{}, "POST:Lunbotu")

}
